package cn.cjp.m3d22;

public class UseOuter {
    public static void main(String[] args) {
        Outer.Inner one = new Outer().new Inner();
        one.methodinner();
        System.out.println("===================");

        //调用局部内部类
        Outer two = new Outer();
        two.merthodouter();
        System.out.println("===================");

        //只使用一次实现类，可以选择用匿名内部类
        MyInterface myInterface = new MyInterface() {
            @Override
            public void method() {
                System.out.println("匿名内部类");
            }
        };
        myInterface.method();

        //匿名对象使用匿名内部类
        new MyInterface(){

            @Override
            public void method() {
             System.out.println("匿名内部类2");
            }
        }.method();

    }
}
